package com.visibler.shiyan;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

import java.util.Arrays;

@SpringBootApplication
public class ShiyanApplication {

    public static void main(String[] args) {
        SpringApplication.run(ShiyanApplication.class, args);
    }
    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext act){
        System.out.println("由springboot注册的所有Bean: ");
        return args -> {String [] beans = act.getBeanDefinitionNames();
            Arrays.sort(beans);
            for(String bean : beans){
                System.out.println(bean);
            }
        };
    }
}
